{include file="public_iframe:head"}
<style>
.hd td{height:100px;}
</style>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">

                        <form class="navbar-form form-inline" action="" method="get">
                            <div class="sDiv">
                              <div class="sDiv2">
                                <input name="start_time" class="input-sm form-control" onclick="laydate()" autocomplete="off" placeholder="开始时间" value="{$start_time}">
                                <input type="hidden" name="ids" value="" >
                                <input name="end_time" class="input-sm form-control" onclick="laydate()" autocomplete="off" placeholder="结束时间" value="{$end_time}">
                                <select class="input-sm form-control" name="is_excls" style="margin-bottom: 0px">
                                    <option value="">是否导出</option>
                                    <option value="1">导出</option>
                                </select>
                                <input  class="btn btn-sm btn-primary" style="margin-bottom: 0px" type="submit" value="搜索">
                              </div>
                            </div>
                        </form>
                </div>
                <div class="ibox-content">
                    <div class="table-responsive">
                        <form id="dxcheckbox">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th style="width:300px;display: inline-block">id</th>
                                <th style="width:300px;display: inline-block">发送号码</th>
                                <th style="width:300px;display: inline-block">发送内容</th>
                                <th style="width:300px;display: inline-block">发送时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="list" id="vo"}
                            <tr class="hd">
                                <td style="width:300px;overflow:hidden;text-overflow:ellipsis;display: inline-block; vertical-align: top;"><span style="vertical-align: middle;"><input type="checkbox" name="id" class="i-checks" onchange="duanxin_modify($(this))" value="{$vo.id}"></span></td>
                                <td style="width:300px;overflow:hidden;text-overflow:ellipsis;display: inline-block; vertical-align: top;"><span style="vertical-align: middle;">{$vo.mobile_lib_string}</span></td>
                                <td style="width:300px;overflow:hidden;text-overflow:ellipsis;display: inline-block""><span style="vertical-align: middle;">{$vo.content}</span></td>
                                <td style="width:300px;overflow:hidden;text-overflow:ellipsis;display: inline-block""><span style="vertical-align: middle;">{$vo.send_time}</span></td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                        <div class="jia-btn">
                            <button type="button" class="all btn btn-info">全选</button>
                            <button type="submit" class="btn btn-primary">删除</button>
                        </div>
                        </form>
                    </div>
                </div>
                {$page}
            </div>
        </div>
    </div>
    <script type="text/javascript">
        function duanxin_modify(obj){
            var id = obj.val();
            var ids_string = $('input[name="ids"]').val();
            if(obj.is(':checked')){
                if(ids_string == ''){
                    $('input[name="ids"]').val(id);
                }else{
                    var strng_change = ids_string+','+id;
                    $('input[name="ids"]').val(strng_change);
                }
            }else{
                ids_string = ids_string.replace(id,'');
                $('input[name="ids"]').val(ids_string);
            }
        }

        var i = 0;
        $('.all').on('click', function (){
            if(i % 2 == 0){
                $('input[type=checkbox]').prop('checked', true);
            }else{
                $('input[type=checkbox]').prop('checked', false);
            }

            i++;
        })

        $('#dxcheckbox').on('submit', function (){
            var values = $(this).serializeArray()            
            var id = []

            values.forEach(function (cur, index){
                if(cur.name == 'id'){
                    id.push(cur.value)
                }
            });

            if(id.length == 0){
                layer.alert('请选择删除条数！');
                return false;
            }

            var string_ids = id.join('-');

            var formData = new FormData();
            formData.append('string_ids',string_ids);


            layer.confirm('是否确认删除？', {
              btn: ['是','否'] //按钮
            }, function(){
                $.ajax({
                    url:"{:url('Mobile/del_send_recode')}",
                    type:'POST',
                    data:formData,
                    async:false,
                    processData:false,
                    contentType:false,
                    success:function(result) {
                        window.location.reload();
                    }
                });
            }, function(){
              
            });
            return false;
        })
    </script>
</div>
</body>
</html>
